﻿using System;
using System.Collections.Generic;

namespace WINPE_TOOLBOX
{
    // 定义 UpdateLatest 类（假设它在 update.cs 中定义）
    public class UpdateLatest
    {
        // 根据需要定义 UpdateLatest 的属性和方法
    }

    // 定义 Config 类
    public class Config
    {
        private static readonly Config _instance = new Config();

        // 私有构造函数，防止外部实例化
        private Config()
        {
            Api = new ApiConfig();
            State = new StateConfig();
            Environment = new EnvironmentConfig();
            Resources = new ResourcesConfig();
            Directory = new DirectoryConfig();
            Notice = new NoticeConfig();
            Download = new DownloadConfig();
            Setting = new SettingConfig();
        }

        public static Config Instance => _instance;

        public ApiConfig Api { get; set; }
        public StateConfig State { get; set; }
        public EnvironmentConfig Environment { get; set; }
        public ResourcesConfig Resources { get; set; }
        public DirectoryConfig Directory { get; set; }
        public NoticeConfig Notice { get; set; }
        public DownloadConfig Download { get; set; }
        public SettingConfig Setting { get; set; }
    }

    // 定义 ApiConfig 类
    public class ApiConfig
    {
        public string Api { get; set; }
        public string Btwiseapi { get; set; }
        public string Ghapi { get; set; }
        public string Dl { get; set; }
    }

    // 定义 StateConfig 类
    public class StateConfig
    {
        public string Install { get; set; } // "noDown", "noSetup", "ready"
        public string ResUpdate { get; set; } // "without", "needUpdatePE", "needUpdateClient"
        public object SetupToSys { get; set; } // int or "without"
    }

    // 定义 EnvironmentConfig 类
    public class EnvironmentConfig
    {
        public HotPEDriveConfig HotPEDrive { get; set; } = new HotPEDriveConfig();
        public WareConfig Ware { get; set; } = new WareConfig();
    }

    public class HotPEDriveConfig
    {
        public NewDriveConfig New { get; set; } = new NewDriveConfig();
        public List<string> All { get; set; } = new List<string>();
    }

    public class NewDriveConfig
    {
        public int DiskIndex { get; set; }
        public string Letter { get; set; }
        public bool IsMove { get; set; }
        public string Version { get; set; }
    }

    public class WareConfig
    {
        public SystemConfig System { get; set; } = new SystemConfig();
        public List<DisksInfo> Disks { get; set; } = new List<DisksInfo>();
        public List<PartitionInfo> Partitions { get; set; } = new List<PartitionInfo>();
        public List<string> AllLetter { get; set; } = new List<string>();
    }

    public class SystemConfig
    {
        public string Os { get; set; }
        public string BuildNumber { get; set; }
        public string UserName { get; set; }
        public string Architecture { get; set; }
        public string Firmware { get; set; }
    }

    // 定义 ResourcesConfig 类
    public class ResourcesConfig
    {
        public PeConfig Pe { get; set; } = new PeConfig();
        public ClientConfig Client { get; set; } = new ClientConfig();
    }

    public class PeConfig
    {
        public string New { get; set; }
        public List<string> All { get; set; } = new List<string>();
        public List<string> LocalWim { get; set; } = new List<string>();
        public UpdateLatest Update { get; set; }
    }

    public class ClientConfig
    {
        public string New { get; set; }
        public List<object> All { get; set; } = new List<object>();
        public UpdateLatest Update { get; set; }
    }

    // 定义 DirectoryConfig 类
    public class DirectoryConfig
    {
        // 根据需要定义属性
    }

    // 定义 NoticeConfig 类
    public class NoticeConfig
    {
        public bool Show { get; set; }
        public string Type { get; set; } // Type 类型需要定义
        public string Content { get; set; }
    }

    // 定义 DownloadConfig 类
    public class DownloadConfig
    {
        public int Thread { get; set; }
    }

    // 定义 SettingConfig 类
    public class SettingConfig
    {
        public PeSettingConfig Pe { get; set; } = new PeSettingConfig();
        public ClientSettingConfig Client { get; set; } = new ClientSettingConfig();
    }

    public class PeSettingConfig
    {
        public int BootWaitTime { get; set; }
    }

    public class ClientSettingConfig
    {
        public string ThemeMode { get; set; } // "dark", "light", "auto"
    }

    // 定义 DisksInfo 类
    public class DisksInfo
    {
        public int Index { get; set; }
        public string Name { get; set; }
        public bool Movable { get; set; }
        public string Size { get; set; }
        public int Q { get; set; } // 未知用途
    }

    // 定义 PartitionInfo 类
    public class PartitionInfo
    {
        public int DiskIndex { get; set; }
        public int PartitionIndex { get; set; }
        public string Letter { get; set; }
        public string Label { get; set; }
        public string Size { get; set; }
        public string UsableSize { get; set; }
        public string FileSystem { get; set; }
        public string Type { get; set; }
        public bool GPT { get; set; }
        public bool Active { get; set; }
    }
}
